package com.guigu.liuyunan.controller;

import com.guigu.liuyunan.pojo.Analysis;
import com.guigu.liuyunan.pojo.February;
import com.guigu.liuyunan.service.AnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("LYN")
public class AnalysisController {
    @Autowired
    AnalysisService as;

    @PostMapping("gyCount")
    public List<Analysis> gyCount(@RequestBody Analysis analysis){
        if (analysis.getValue()!=null) {
            Integer d = Integer.parseInt(analysis.getValue().substring(0, 4)) + 1;
            analysis.setValue(d.toString());
        }
        return as.gynum(analysis);
    }

    @PostMapping("gytiaoshu")
    public List<Integer> gytiaoshu(@RequestBody February february){
        return as.gytiaoshu(february);
    }

}
